﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>登陆</title>
<meta name="baidu-site-verification" content="mQzDYq8fHL" />
<meta name="360-site-verification" content="ed795688ce80828a0dd8f5ad9c05e4b1" />
<meta name="keywords" content="云钢联合,废旧、二手、废钢、二手设备、闲置设备拆除、废料、废电缆、废电机、报废车辆">
<meta name="description" content="云钢联合,废钢材、冶金设备、废铜套、招标、拍卖、钢厂废旧物资、废旧次材、整厂拆除">
<link href="css/base.css" rel="stylesheet" type="text/css">
<link href="css/css.css" rel="stylesheet" type="text/css">
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/common_js.js"></script>
    <style>
        .loginPage {
            background-image: url(images/login_bg.jpg);
            background-repeat: no-repeat;
            background-position: center center;
            background-attachment: fixed;
            background-size: cover;
        }
    </style>
</head>

<body class="loginPage ">
<!--<div class="login-top">-->
    <!--<div class="wrapper">-->
        <!--<div class="fl font30"><img src="images/logo.jpg" style=""/></div>-->
        <!--<div class="fr">您好，欢迎使用云钢联合系统！</div>-->
    <!--</div>-->
<!--</div>-->
<!--<p style="text-align: center;font-size: 24px;color: #fff">云钢综合平台</p>-->
<div class="l_main" style="margin-top: 200px">

    <div class="loginbox fl">
        <div class="conlist">
            <div class="conbox" style="display:block;">
                <p>
                    <input type="text" class="loginusername" placeholder="用户名">
                </p>
                <p>
                    <input type="password" class="loginuserpassword" placeholder="密码">
                </p>
                <p><span class="fl fntz14 margin-t10"><a href="register.html" style="color:#ff6000">没有账号？立即注册</a></span>
                    <!--<span class="fr fntz12 margin-t10"><a href="#">忘记密码？</a></span>-->
                </p>
                <p>
                    <input type="button" class="loginbtn" value="登  录">
                </p>
            </div>
        </div>
    </div>
    <div class="fr margin-r100 margin-t45"><img src="images/login-pic2.jpg" width="507" height="325"></div>
</div>
<script>
    $('.loginbtn').on('click',function () {
        var username = $('.loginusername').val()
        var password = $('.loginuserpassword').val()
        var data = {
            username:username,
            password:password
        }
        $.ajax({
            url: DATA_API_HOST + '/authorize/login',
            type: 'POST',
            dataType: 'json',
            contentType: 'application/json',
            data:JSON.stringify(data),
            success: function (data) {
                if(typeof data === "string"){
                    data = JSON.parse(data);
                }

                if(data.errCode == 0){  //succ
                    var res = JSON.parse(data.data)
                    var result = {
                        token: res.access_token,
                        expire_at: parseInt(res.expire_at) + parseInt(getNowTime()) - 60
                    };
                    localStorage.setItem('LOGIN_ACCESS_TOKEN',JSON.stringify(result));
                    window.location.href='index.html';
                }
                else if(data.errCode == 401){  //登录过期
                    window.location.href="login.html"
                }
                else{  //fail
                    alert(data.msg)
                    return;
                }

            },
            complete:function (data) {

            }
        });
    })
</script>
</body>
</html>
